package com.zenghus.view.simpl.core;

import java.lang.reflect.Method;
import java.util.HashMap;
import java.util.Map;

public class EventLisenter {

    Map<Enum,Event> events=new HashMap<Enum, Event>();

    public void addLisenter(Enum enums,Object callback, Method trigger){
        Event event=new Event(callback,trigger);
        events.put(enums,event);
    }

    public void trigger(Enum en){
        if (!events.containsKey(en)){ return;}
        Event event=events.get(en);
        try {
            event.trigger.invoke(event.callback,null);
        }catch (Exception e){
            e.printStackTrace();
        }
    }

}
